package com.kexinde.wjifen.service.impl;

import java.util.List;

import org.springframework.stereotype.Component;

import com.kexinde.wjifen.dao.impl.ActivityDao;
import com.kexinde.wjifen.dao.impl.ShopDao;
import com.kexinde.wjifen.model.Activity;
import com.kexinde.wjifen.model.Shop;
import com.kexinde.wjifen.service.IActivityManager;
@Component("activityManager")
public class ActivityManager implements IActivityManager {

	private ShopDao shopDao;
	private ActivityDao activityDao;
	@Override
	public List<Activity> showAll(long shopId) {
		// TODO Auto-generated method stub
		Shop shop=shopDao.findById(shopId);
		return shop.getActivities();
	}

	@Override
	public Activity showOne(long shopId, long activityId) {
		// TODO Auto-generated method stub
		return activityDao.findById(activityId);
	}

	@Override
	public boolean add(Activity activity) {
		// TODO Auto-generated method stub
		return activityDao.doInsert(activity);
	}

	@Override
	public boolean modify(Activity activity) {
		// TODO Auto-generated method stub
		return activityDao.doUpdate(activity);
	}

	@Override
	public boolean delete(Activity activity) {
		// TODO Auto-generated method stub
		return activityDao.doDelete(activity);
	}

}
